<template>
  <router-link class="book-item" tag="section" :to="{path:'/bookdetail',query:{id:book.id}}" param="{id:book.name}">
    <img v-lazy="book.cover"/>
    <div class="content">
      <div class="title">{{book.name}}</div>
      <div class="author">{{book.author}}</div>
      <div class="status">{{!!book.read_chapter_count ? `已读${book.read_chapter_count}章` : '还未开始阅读'}}</div>
    </div>
    <!-- <mt-button type="primary" @click.stop="challenge" v-if="!!book.read_chapter_count">继续挑战</mt-button> -->
  </router-link>
</template>

<script>
export default {
  props: {
    book: {
      type: Object,
      default: {}
    }
  },
  methods: {
    challenge() {
      console.log("challenge");
    }
  }
};
</script>

<style lang="scss" scoped>
@import "~@/assets/scss/const.scss";
@import "~@/assets/scss/mixin.scss";

.book-item {
  background: $app-background-color;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  margin: 20px;
  width: 90%;
  overflow: hidden;
  justify-content: center;
  align-items: center;
  img {
    display: block;
    width: 90px;
    min-width: 90px;
    height: 120px;
    margin-right: 10px;
    background: #e9e9e9;
  }
  .content {
    flex: 1;
    line-height: 20px;
    font-size: 12px;
    color: #999999;
    font-family: PingFang-SC-Medium;
    line-height: 30px;
    min-width: 0;
    .title {
      font-size: 16px;
      color: #1a1a1a;
      margin-bottom: 8px;
      @include ellipsis(1);
    }
    .price {
      color: #eb4c43;
    }
  }
  button {
    width: 80px;
    min-width: 80px;
    font-size: 12px;
    color: #ffffff;
    height: 25px;
    border-radius: 13px;
    align-self: flex-end;
  }
}
</style>
